package org.cargloss.cp.controller.modul.staticpage;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.cargloss.cp.model.StaticPage;

import util.hibernate.DAO;

import com.opensymphony.xwork2.ActionSupport;

public class ActionJsonMap extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Map<String, String> listStaticPage = new HashMap<String, String>();

	// private List<StaticPage> listStaticPage;
	@SuppressWarnings("unchecked")
	public String execute() {
		DAO<Integer> dao = new DAO<Integer>();
		List<StaticPage> list = (List<StaticPage>) dao
				.findAll(StaticPage.class);

		listStaticPage.put("Ext", "Extrnal Url");

		for (StaticPage f : list) {
			listStaticPage.put(f.getUrl(), f.getTitle() + " " + f.getUrl());
		}
		dao.close();
		return SUCCESS;
	}

	public Map<String, String> getListStaticPage() {
		return listStaticPage;
	}

	public void setListStaticPage(Map<String, String> listStaticPage) {
		this.listStaticPage = listStaticPage;
	}


}
